package top.malaoshi.netdisk.ctrl;

import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.malaoshi.netdisk.service.UserSrvImpl;
import top.malaoshi.netdisk.vo.JsonResult;
import top.malaoshi.netdisk.vo.ModifyPassword;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.sql.SQLException;

@RestController
@RequestMapping("/user")
public class UserCtrl {

    @Resource
    private UserSrvImpl userSrv;
    /**
     * 修改密码
     * @param modifyPassword
     * @return
     */
    @PostMapping("/modifyPassword")
    @Validated
    public JsonResult modifyPassword(@Valid @RequestBody ModifyPassword modifyPassword) throws SQLException {
        JsonResult jsonResult = userSrv.modifyPassword(modifyPassword);
        return jsonResult;
    }
}
